Universal Serial Bus (hereinafter, USB) is a standard of an interface, which has been developed for enhancing the expandability of a peripheral device (device/function device) connected to a host such as a personal computer. USB is a serial interface standard which allows communications between a host and various USB-compliant devices to be performed via a common bus line.
Under USB standard, in principle, one host (USB host) can be connected with up to 127 devices via a common bus, in one system. These devices are, in physical terms, networked in a tree. In logical terms, meanwhile, it is considered that a host (client software) and a device (USB function) perform one-to-one communications with each other. To maintain such connection, each device (more specifically, a protocol of the bottom layer of each device) communicates with the host in a time sharing fashion. The host performs scheduling in a time sharing fashion.
USB 1.x defines two modes having different data transfer rates, i.e. low-speed mode (LS) of 1.5 Mbps and full-speed mode (FS) of 12 Mbps.
In recent years, devices (applications) requiring high-speed data transmission (e.g. hard disks and DVD (Digital Versatile Disc)) have also employed USB. On this account, the above-mentioned transfer rates are not sufficient for such devices. To solve this problem, a new standard termed USB 2.0 was developed. In this USB 2.0, high-speed mode (HS) achieving 480 Mbps data transmission is added.
Now, how data communication (data transmission) is performed under USB standard is briefly described. The data transmission under USB standard is performed between a host and a buffer of each device.
The buffer on the device side is a FIFO (First In First Out) buffer termed an end point. Each device can have 16 end points at the maximum. Each end point has a number for identification purposes.
To perform the data transmission, the host accesses to a desired end point, with reference to an address of a device and an end point number.
Note that, an end point 0 (which has a number 0) exists immediately after USB-connecting the device (i.e. before configuration), and is used for communication to transfer control to the host (e.g. communication for initialization). Each USB function must have one end point 0.
The data transmission between the host and device is performed using communication “frame”. This frame is repeatedly transferred between the host and device at predetermined intervals (in a 1 ms cycle in the LS and FS modes, while in a 125 us cycle in the HS mode). All sorts of data are exchanged by this frame.
The frame is made up of a plurality of transactions, and one transaction is made up of a plurality of packets.
A packet is the minimum communication unit constituting the transaction, and is a basic unit of data which is actually exchanged. Packets are classified into some different types, in accordance with the contents. Examples of such types include token packet, data packet, and handshake packet. The transaction includes a plurality of such packets and is a meaningful unit of data transmission.
That is to say, the data transmission under USB is, in one frame, performed by transactions, and in one transaction, a plurality of packets are exchanged between the host and device.
The above-mentioned token packet includes an address of each device and an end point number, allowing the host to identify the counterpart of the data communication.
FIG. 42 illustrates the types of USB packets. As shown in this figure, packets are classified into token packet, data (DATA) packet, handshake packet, and special packet.
The token packet is further divided into IN packet, OUT packet, SETUP packet, and SOF packet. These packets are used for the objectives shown in FIG. 42. The data packet is further divided into DATA0 packet, DATA1 packet, and the like. The handshake packet is further divided into ACK packet, NAK packet, STALL packet, and NYET packet. The special packet is PING packet and the like.
FIG. 43 illustrates formats of USB packets. PID in the figure is an identifier of the packets and is 8 bits in length. To the token packet, CRC5 is added. Meanwhile, to the data packet, CRC16 is added. These CRCs are used for identifying the existence of an error in a received packet.
The SOF (Start of Frame) packet, which is one type of the token packet, indicates the start of a frame supplied from the host. The SOF packet is supplied from the host, at intervals of 1 ms (in the LS and MS modes) or at intervals of 125 us (in the HS mode).
[IN Transaction]
In transaction is a method that, under USB 2.0, a USB host read out data from a USB function. The following will discuss this IN transaction in reference to FIG. 44.
First, at a timing t2201, an IN packet is supplied from the USB host to the USB function. At the instant of receiving the IN packet, the USB function has no data to be transferred. Therefore, the USB function sends a NAK packet, which indicates that there is no data to be transferred, to the USB host, at a timing t2202. Upon receiving the NAK packet, the USB host recognizes that in the USB function there is no data to be transferred, so that the USB host again supplies an IN packet to the USB function, at a timing t2203. Receiving the IN packet, the USB function in this instance has data to be transferred, so as to supply a DATA packet to the USB host at a timing t2204. If the USB host unerringly receives the DATA packet within a predetermined period of time, an ACK packet indicating correct receipt is dispatched to the USB function, at a timing t2205.
Since the CRC16 has been added to the DATA packet, the data receiving side can judge whether or not the received data has an error, by checking the added CRC. If the judgment by the CRC reveals that the data has an error, the USB host returns no packet to the USB function. In other words, the receipt of the ACK packet from the USB host makes the USB function recognize that the data transmission to the SUB host has successfully been carried out. If the USB function cannot receive the ACK packet from the USB host within a predetermined period of time, the USB function recognizes that the data transmission to the USB host is not successfully carried out and the IN transaction has failed.
In this manner, the IN transaction is carried out and the USB host can read out data from the USB function.
[OUT Transaction]
OUT transaction is a method that, under USB 2.0, a USB host writes data into a USB function. The following will discuss the OUT transaction in reference to FIG. 46.
First, at a timing t1901, the USB host supplies an OUT packet to the USB function, so as to notify the start of the OUT transaction. Then at a timing t1902, the USB packet outputs a DATA packet. The USB function conducts the CRC-check of the OUT packet and the DATA packet supplied from the USB host, so as to check the existence of an error in the received packets. If no error is found in the received packets, the USB function returns, to the USB host, either: an ACK packet if the USB function is ready to process the received DATA packet; or a NAK packet if the USB function is not ready to process the received DATA packet. If the received packets includes an error, nothing is returned to the USB host. In FIG. 46, no error is found in the received packets but the USB function is not ready to process the received DATA packet, so that the NAK packet is returned at a timing t1903.
Receiving the NAK packet, the USB host recognizes that the USB function is not ready to process the received packet. Therefore, to grasp the state of the USB function, the USB host outputs a PING packet at a timing t1904. Receiving this PING packet, the USB function supplies, to the USB host, either: an ACK packet if ready to process data; or a NAK packet if not ready to process data. In FIG. 46, the USB function is ready to process data at a timing t1905, so as to return the ACK packet.
Since the ACK packet is returned in response to the PING packet, the USB host recognizes that the USB function is ready to process data. If, meanwhile, the USB host receives the NAK packet, the USB host recognizes that the USB function is not ready to process data, so as to continually transmit the PING packet until the USB function becomes ready to process data. In FIG. 46, the ACK packet is returned in response to the PING packet, so that it is confirmed that the USB function is ready to process data. Therefore, the USB host outputs the OUT packet again at a timing t1906, and outputs the DATA packet again at a timing t1907. Receiving these packets, the USB function on this occasion is ready to process data, so as to CRC-check the received packets. If no error is found, the USB function outputs the ACK packet. Receiving this ACK packet, the USB host recognizes that the OUT packet and the DATA packet have successfully been transmitted to the USB function and have been processed. On this account, the OUT transaction finishes.
By the OUT transaction carried out in the manner above, the USB host can write data into the USB function.
[Time Constraint Regarding USB]
In USB 2.0, the time for propagating data signal is under constraints.
In the LS mode or FS mode, the turn-around time from the USB host to the USB function must be 16 bit times (1333 ns) or less. That is to say, if, within 1333 ns, the USB function does not return a reply packet to the USB host in response to a packet supplied from the USB host to the USB function, the USB host judges that the packet outputted from the USB host did not successfully reach the USB function, so as to retransmit the packet.
In the HS node, the turn-around time (TA time) from the USB host to the USB function must be 721 bit times (1502 ns) or less. If, within 1502 ns, the USB function does not return a reply packet to the USB host in response to a packet supplied from the USB host to the USB function, the USB host judges that the packet outputted from the USB host did not successfully reach the USB function, so as to retransmit the packet.
In the above-mentioned IN transaction, how long the USB host waits after sending the IN packet and how long the USB function waits after sending the DATA packet are determined in advance, as the time constraint of USB. The time constraint is 1333 ns in the LS and FS modes and 1502 ns in the HS mode. In each transaction mode, the IN transaction does not properly finishes unless the DATA packet or the ACK packet is supplied within the time constraint.
In the OUT transaction, meanwhile, how long the USB host waits after sending the DATA packet is determined in advance as the time constraint of USB: 1333 ns in the LS and FS modes and 1502 ns in the HS mode. In each transfer mode, the OUT transaction does not properly finishes unless the ACK packet (or other types of the handshake packet) is supplied within the time constraint.
[SETUP Transaction]
The following will discuss a SETUP transaction under USB.
The SETUP transaction is carried out, under USB 2.0, for establishing the connection between a host and a device in a systematic sense (i.e. for establishing a configuration), on the occasion of connecting a device with a host. This transaction is performed in such a manner that the host transmits data to the end point 0 of the device. Referring to FIG. 48, this SETUP transaction is described below.
In the SETUP transaction, at a timing T301, the host transmits a SETUP packet to the device, so as to notify the start of the SETUP transaction. Then at a timing T302, the host outputs a DATA packet. The device checks the CRC of the SETUP packet and the CRC of the DATA packet having been received.
If it is judged that the received packets include no error, the device supplies an ACK packet to the host at a timing T303. Meanwhile, if it is judged that the received SETUP and DATA packets include an error, the device returns nothing to the host.
Receiving the ACK packet, the host recognizes that the SETUP packet and the DATA packet have successfully been transmitted to the device, so as to finish the SETUP transaction.
If the ACK packet is not returned within a predetermined time (maximum turn-around time) after sending the DATA packet, the host recognizes that the SETUP packet or the DATA packet has not properly been transmitted to the device, i.e. recognizes that the SETUP transaction has failed. On this account, the host supplies the SETUP packet and the DATA packet to the device again. In this manner, the SETUP transaction between the host and device is carried out.
Note that, the aforesaid maximum turn-around time (maximum TA time) is the above-mentioned constraint for the propagation of a data signal under USB 2.0. That is to say, the turn-around time (TA time) starts when one of the host and the device sends a packet to the other, and finishes when said one of the host and the device receives a reply packet from the other. The maximum TA time indicates the upper limit of the TA time. If a reply packet is not returned within the maximum TA time, the host judges that the packet transmission to the device has failed, so as to retransmit the packets.
The maximum TA time in the LS and FS modes is 16 bit times (1333 ns). In the HS mode, the maximum TA time is 721 bit times (1502 ns).
For instance, in the SETUP transaction, if, after sending the DATA packet, the host does not receive the ACK packet from the device until 1333 ns (LS and FS) or 1502 ns (HS) has past, the host retransmits the SETUP packet and the DATA packet to the device.
Incidentally, in recent years, mobile devices such as digital cameras and PDAs (Personal Digital Assistants) have increasingly been provided with USB terminals, so as to support USB.
The connection between such a mobile device and a host is typically done by utilizing a cradle. That is to say, a USB connector of a cradle connected to a host is connected to a USB connector of a mobile device, so that the USB transmission is realized.
Such USB connectors physically contact each other. For this reason, repeating connection/disconnection deteriorates the connector and hence high-quality data transmission may become inexecutable.
To do away with such a physical connection, there is a technique which allows a host and a mobile device to perform free-space optical communications with each other. This type of technique is disclosed by, for instance, Patent Document 1 (Japanese Laid-Open Patent Application No. 2000-284872 (Tokukai 2000-284872; published on Oct. 13, 2000)).
However, to fully support the high speed mode of USB 2.0, it is necessary to conduct free-space transmission of data while keeping the transfer rate of 480 Mbps. For this reason, an optical communication section (optical system and two-way transmission section) provided in each of the host and the device has to have high CDR (Clock Data Recovery) properties, and this increases the costs.
To restrain this cost rise, the data transmission under USB 2.0 can be performed with a lower transfer rate of optical communication. However, this induces the following problems.
[IN Transaction]
FIG. 45 illustrates how the IN transaction is carried out on condition that the transfer rate on an optical communication path is 100 Mbps so as to be slower than the native rate (480 Mbps) under USB 2.0.
An IN packet dispatched from the USB host at a timing t2301 is converted to an optical signal by a host-side controller, and is supplied to a function-side controller. The function-side controller extracts a USB packet from the received optical signal, and supplies the USB packet to the USB function. Note that, the function-side controller starts the transmission to the USB function at a timing t2302, because the transmission to the USB function is carried out at the USB-native rate of 480 Mbps.
Finishing the receipt of the IN packet at a timing t2303, the USB function sends a DATA packet to the USB host at a timing t2304. The function-side controller converts this DATA packet to an optical signal, and supplies the optical signal to the host-side controller. As in the case of the function-side controller, after the receipt of the DATA packet finishes, the host-side controller transmits the DATA packet to the USB host at a timing t2305. At a timing t2306, the USB host can finally receive the DATA packet from the USB function.
When the rate of data transmission between the host and function is slower than the native rate of USB 2.0 (especially when the length of the DATA packet is long), the time (turn-around time) from t2301 to t2306 is long and exceeds the maximum turn-around time (1502 ns in the HS mode). For this reason, the IN transaction does not properly finish.
[OUT Transaction]
FIG. 47 illustrates how the OUT transaction is carried out on condition that the transfer rate on an optical communication path is 100 Mbps so as to be slower than the native rate (480 Mbps) under USB 2.0.
The USB host outputs an OUT packet at a timing t2001 and a DATA packet at a timing t2002, and these packets are converted to optical signals by the host-side controller, and the optical signals are then supplied to the function-side controller. The function-side controller extracts a USB packet from the received optical signal, and supplies this USB packet to the USB function. The function-side controller starts the transmission to the USB function at a timing t2003, because the transmission to the USB function is performed at the USB native rate (480 bps).
If the USB function can receive the OUT packet and DATA packet with no error and process them, the ACK packet is supplied to the USB host. The function-side controller converts this ACK packet to an optical signal, and supplies the optical signal to the host-side controller. As in the case of the function-side controller, after the receipt of the ACK packet finishes, the host-side controller transmits the ACK packet to the USB host at a timing t2005. At a timing t2006, the USB host can finally receive the ACK packet from the USB function.
When the rate of data transmission between the host and function is slower than the native rate of USB 2.0 (especially when the length of the DATA packet is long), the time (turn-around time) from t2001 to t2006 is long and exceeds the maximum turn-around time (1502 ns in the HS mode). For this reason, the OUT transaction does not properly finish.
FIG. 47 illustrates a case that the USB function returns the ACK packet in response to the OUT packet and the DATA packet supplied from the USB host. However, in the OUT transaction, a handshake packet (e.g. NAK packet) rather than the ACK packet may be returned, when the USB function is in a certain state on the occasion of receiving the OUT packet and the DATA packet. Also in the case that the USB function returns a handshake packet rather than the ACK packet, the OUT transaction is not properly carried out if the receipt of this handshake packet by the USB host exceeds the maximum turn-around time, so that a problem similar to the above occurs.
[SETUP Transaction]
FIG. 49 is a timing chart illustrating the SETUP transaction on condition that: the rate of the communication between the host and the optical communication section of the host (i.e. host optical communication section) is 480 Mbps; the rate of the communication between the host optical communication section and the optical communication section of the device (i.e. device optical communication section) is 100 Mbps; and the rate of the communication between the device optical communication section and the device is 480 Mbps.
As shown in FIG. 49, at T401 and T402, a SETUP packet and a DATA packet which are supplied from the host are converted to optical signals by the host optical communication section, and the optical signals are supplied to the device optical communication section at the rate of 100 Mbps.
The device optical communication section extracts the SETUP packet and the DATA packet from the received optical signals, and supplies the packets to the device at the rate of 480 Mbps (T403).
Note that, taking account of the difference of communication rates, the device optical communication section transmits the SETUP packet and the DATA packet to the device, after completely receiving both of these packets.
Subsequently, if the device has successfully received the SETUP packet and the DATA packet and has successfully processed these packets, the device supplies an ACK packet to the host at T404. This ACK packet is supplied to the host optical communication section at the rate of 100 Mbps, via the device optical communication section.
The host optical communication section extracts the ACK packet from the received optical signal, and transmits this ACK packet to the host at the rate of 480 Mbps (T405). Then the host receives this ACK packet from the device at T406.
In this arrangement, however, since the rate of the transmission between the optical communication sections is low, the time (TA time) between T491 to T406 is long.
In particular, when the size (packet length) of the DATA packet supplied from the host is large (long), the TA time may exceed a predetermined value (maximum TA time).
In such a case, the host keeps sending the SETUP packet and the DATA packet to the device, even if these packets are successfully received by the device, and hence the SETUP transaction cannot finish.